import {
	useNotificationStore
} from '@/stores/index.js'

import {
	store,
	mutations
} from '@/uni_modules/uni-id-pages/common/store.js'
const notificationStore = useNotificationStore()

// 设置我的页面tabbar角标
export const setTabBarBadge = async () => {
	try {
		if (notificationStore.notifCount > 0 && store.hasLogin) {
			await uni.setTabBarBadge({
				index: 4,
				text: notificationStore.notifCount.toString()
			})
		} else {
			await notificationStore.clearNotification()
		}
	} catch (e) {
		// console.log(e);
		//TODO handle the exception
	}
}